package cn.elricyu.tt.bean.battle.resource;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class MyNongTian {

	private int techfood;

	private int rescount;

	private Map<Integer, NongTian> nongTianMap = new LinkedHashMap<Integer, NongTian>();

	private List<AttackedNongTian> attackedNongTianList = new ArrayList<AttackedNongTian>();

	public int getTechfood() {
		return techfood;
	}

	public void setTechfood(int techfood) {
		this.techfood = techfood;
	}

	public int getRescount() {
		return rescount;
	}

	public void setRescount(int rescount) {
		this.rescount = rescount;
	}

	public Map<Integer, NongTian> getNongTianMap() {
		return nongTianMap;
	}

	public List<AttackedNongTian> getAttackedNongTianList() {
		return attackedNongTianList;
	}

	public void addNongTian(NongTian nongTian) {
		nongTianMap.put(nongTian.getResourceid(), nongTian);
	}

	public void addAttackedNongTian(AttackedNongTian attackedNongTian) {
		attackedNongTianList.add(attackedNongTian);
	}

	public String getAttackResourceId(boolean attackPlayer) {
		for (Entry<Integer, NongTian> entry : nongTianMap.entrySet()) {
			NongTian nongTian = entry.getValue();
			if (nongTian.isFree()) {
				return nongTian.getResourceid() + "";
			}
		}
		return "";
	}

}
